namespace ghost
{
    export enum AttriCallType{
        HP = 1,
        HPMAX = 1<<1,
        HPSHIELD = 1<<2,
        MP = 1<<3,
        MPMAX = 1<<4,
        SP = 1<<5,
        SPMAX = 1<<6        
    }
    export class AttriCall
    {
        /**属性变更通知*/
		public static call(s:GameRole, flag:number):void
		{			
            let notify = GameDispatcher.instance;
			if(flag > 0)
			{				
				if(flag & AttriCallType.HP)
				{
					if(s.isMyPlayer)
					{
						if(notify.hasListener(GameEvent.PLAYER_HP))
							notify.event(GameEvent.PLAYER_HP, s);
					}
					if(notify.hasListener(GameEvent.HP))
						notify.event(GameEvent.HP, s);
				}
				if(flag & AttriCallType.HPMAX)
				{
					if(s.isMyPlayer)
					{
						if(notify.hasListener(GameEvent.PLAYER_HP_MAX))
							notify.event(GameEvent.PLAYER_HP_MAX, s);
					}
                    if(notify.hasListener(GameEvent.HP_MAX))
						notify.event(GameEvent.HP_MAX, s);
				}
				// if(flag & AttriCallType.HPSHIELD)
				// {
				// 	if(notify.hasListener(GameEvent.BATTLE_SHIELD))
				// 		notify.event(GameEvent.BATTLE_SHIELD, s);
				// }
				// if(flag & AttriCallType.MP)
				// {
				// 	if(s.isMyPlayer)
				// 	{
				// 		if(notify.hasEventListener(CommonEventType.N_BATTLE_PLAYER_MP))
				// 			notify.dispatchEventWith(CommonEventType.N_BATTLE_PLAYER_MP, false, s);
				// 	}
				// 	if(notify.hasEventListener(CommonEventType.N_BATTLE_MP))
				// 		notify.dispatchEventWith(CommonEventType.N_BATTLE_MP, false, s);
				// }
				// if(flag & AttriCallType.MPMAX)
				// {
				// 	if(notify.hasEventListener(CommonEventType.N_BATTLE_PLAYER_MP_MAX))
				// 		notify.dispatchEventWith(CommonEventType.N_BATTLE_PLAYER_MP_MAX, false, s);
				// }
				// if(flag & AttriCallType.SP)
				// {
				// 	if(s.isMyPlayer)
				// 	{
				// 		if(notify.hasEventListener(CommonEventType.N_BATTLE_PLAYER_SP))
				// 			notify.dispatchEventWith(CommonEventType.N_BATTLE_PLAYER_SP, false, s);
				// 	}
				// 	if(notify.hasEventListener(CommonEventType.N_BATTLE_SP))
				// 		notify.dispatchEventWith(CommonEventType.N_BATTLE_SP, false, s);
				// }
				// if(flag & AttriCallType.SPMAX)
				// {
				// 	if(notify.hasEventListener(CommonEventType.N_BATTLE_PLAYER_SP_MAX))
				// 		notify.dispatchEventWith(CommonEventType.N_BATTLE_PLAYER_SP_MAX, false, s);
				// }
			}
		}
    }
}